package com.springboot.lotterysystem.service.enums;


import lombok.Getter;

/**
 * Created with IntelliJ IDEA.
 * Description :
 * User: jiume
 * Date: 2025-04-20
 * Time: 16:38
 */
@Getter
public enum UserIdentityEnum {
    ADMIN("ADMIN"),
    NORMAL("NORMAL");

    private final String identity;

    private UserIdentityEnum(String identity) {
        this.identity = identity;
    }

    // 遍历枚举集合是否存在对应的值
    public static UserIdentityEnum forName(String name) {
        for (UserIdentityEnum userIdentityEnum : UserIdentityEnum.values()) {
            if (userIdentityEnum.getIdentity().equalsIgnoreCase(name)) {
                return userIdentityEnum;
            }
        }
        return null;
    }
}
